#pragma once

#include "audionode.h"

class CADSR : 
	public CAudioNode
{
public:
	enum States{ Attack, Decay, Sustain, Release };

	CADSR(void);
	~CADSR(void);

	virtual void Start();
	virtual bool Generate();

	void SetSource( CAudioNode *aSource ) { mSource = aSource; }
	void SetDuration( double aDuration ) { mDuration = aDuration; }
	// Configures the times for the ADSR class, use values from 0 to 1.
	
	void SetDecay( double aDecay ) { mDecay = aDecay;}
	void SetSustain( double aSustain ) { mSustain = aSustain; }
	void SetRelease( double aRelease ) { mRelease = aRelease;}
	
protected:

	// These values represent the percentage of the way into the duration each of
	// these will hit. This is assuming we start in the Attack phase. Should be 
	// a value between 0 and 1
	double mDecay;
	double mSustain;
	double mRelease;

	double mDuration;
	double mTime;

	

	States mState;

	CAudioNode *mSource;
};

